/*
 *	main.cpp
 *
 *	wav2afp.exe
 *
 *	Audio Finger Print project
 */

#define _CRT_SECURE_NO_WARNINGS

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "..\sglib\spectrogram.h"

int main(const int argc, const char* argv[])
{
	if(argc < 2)
	{
		printf(
			"not enough arguments\n"
			"usage: wav2afp *.wav\n"
			" *.wav - mono, 16 bitn"
			);
		exit(1);
	}

	printf("Block processing size %d\n", SG_INOUT_SIZE);

	WIN32_FIND_DATA FindFileData;
	HANDLE hFind;

	hFind = FindFirstFile(argv[1], &FindFileData);
	if (hFind == INVALID_HANDLE_VALUE) 
	{
		printf("FindFirstFile failed (%d)\n", GetLastError());
		exit(1);
	} 

	SG_ProcessFile(FindFileData.cFileName);

	while(FindNextFile(hFind,&FindFileData))
	{
		SG_ProcessFile(FindFileData.cFileName);
	}

	return 0;
}
